home *** CD-ROM | disk | FTP | other *** search
- { TPBoard 4.2 Copyright (c) 1987,88 by Jon Schneider & Rick Petersen
- Portions Copyright (c) 1986,87 by Steve Fox and Les Archambault
-
- Last modified :: 5-27-88 8:15 pm
- }
-
- {$R-} {Range checking off}
- {$B-} {Boolean complete evaluation off}
- {$S-} {Stack checking off}
- {$I+} {I/O checking on}
- {$N-} {No numeric coprocessor}
-
- Unit NetMisc;
-
- Interface
-
- Uses
- TPCrt, Dos, Globals, Core1, Core2;
-
-
- function Fido_FormTAD(t : tad_array) : StrTAD;
-
- procedure fido_sort(var high_msg_num,
- number_of_msgs : Integer;
- var msg_nums : msg_array);
-
- procedure show_nets;
-
- procedure check_net(num : Integer;
- var offset,
- number_nodes : Integer;
- var OK : Boolean);
-
- procedure check_node(num, net_start,
- number_nodes : Integer;
- var OK : Boolean);
-
- procedure show_nodes(offset, num_nodes : Integer);
-
-
- {==========================================================================}
-
-
- Implementation
-
-
- function Fido_FormTAD(t : tad_array) : StrTAD;
- { Build printable string of current time and date for SeaDog messages }
-
- const
- month : array[1..12] of string[3] =
- ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
-
- var
- i : Integer;
- line, line1 : StrTAD;
-
- begin
- if (t[1] in [0..59]) and (t[2] in [0..23]) then
- line := intstr(t[2], 2)+':'+intstr(t[1], 2)+':'+intstr(t[0], 2)
- else
- line := '';
- for i := 1 to Length(line) do
- if line[i] = ' ' then
- line[i] := '0';
- line1 := intstr(t[3], 2);
- if line1[1] = ' ' then line1[1] := '0';
- if (t[3] in [1..31]) and (t[4] in [1..12]) and (t[5] in [0..99]) then
- Fido_FormTAD := line1+' '+month[t[4]]+' '+intstr(t[5], 2)+' '+line
- else
- Fido_FormTAD := 'No Date'
- end;
-
-
- procedure shell_sort(var values : msg_array;
- lower_bound,
- upper_bound : Integer;
- is_ascending : Boolean);
-
- var
- i, gap : Integer;
- exch_occurred : Boolean;
-
- procedure Swap(var a, b : Integer);
-
- var
- t : Integer;
-
- begin
- t := a;
- a := b;
- b := t
- end;
-
- begin
- gap := Abs((upper_bound-lower_bound)+1) div 2;
- repeat
- repeat
- exch_occurred := False;
- for i := lower_bound to upper_bound-gap do
- if ((values[i] > values[i+gap]) and (is_ascending)) then
- begin
- Swap(values[i], values[i+gap]);
- exch_occurred := True
- end
- else if ((values[i] < values[i+gap]) and (not is_ascending)) then
- begin
- Swap(values[i], values[i+gap]);
- exch_occurred := True
- end;
- until (not exch_occurred);
- gap := gap div 2;
- until (gap = 0);
- end;
-
-
- procedure fido_sort(var high_msg_num,
- number_of_msgs : Integer;
- var msg_nums : msg_array);
-
- { Finds the highest numbered message, and puts
- all the message numbers in a sorted array }
-
- var
- i, n,
- this_msg_num : Integer;
- Filname : DosFileName;
- mask : StrPr;
- abort : Boolean;
- DirInfo : SearchRec;
- attribute : Word;
-
-
- procedure getname;
-
- begin
- Filname := DirInfo.name;
- i := 1;
- while Filname[i] <> '.' do
- Inc(i);
- i := Pred(i);
- Filname[0] := Chr(i);
- end;
-
- begin {fido_sort}
- FillChar(msg_nums, 2048, 0);
- abort := False;
- high_msg_num := 0;
- n := 0;
- mask := '*.MSG'+Chr(0);
- if AreaReq = 'NETMAIL' then
- SetSect(fidomail)
- else
- SetSect(fidomail+'\'+AreaReq);
- Filname := '';
- attribute := 39;
- FindFirst(mask, attribute, DirInfo);
- if DosError = 0 then
- begin
- n := 1;
- getname;
- high_msg_num := strint(Filname);
- msg_nums[n] := high_msg_num;
- repeat
- FindNext(DirInfo);
- if DosError <> 18 then
- begin
- Inc(n);
- getname;
- this_msg_num := strint(Filname);
- if high_msg_num < this_msg_num then
- high_msg_num := this_msg_num;
- msg_nums[n] := this_msg_num;
- end;
- until DosError <> 0;
- end;
- SetSect(HomName);
- number_of_msgs := n;
- if number_of_msgs > 0 then
- shell_sort(msg_nums, 1, number_of_msgs, True);
- end;
-
-
-
- procedure show_nets;
-
- type
- Str20 = string[20];
- Str40 = string[40];
-
- var
- i, x,
- lines,
- offset : Integer;
- str_name : Str20;
- str_city : Str40;
-
- begin
- SetSect(fidolists);
- lines := 1;
- WriteLn(Com);
- with net_hdr do
- begin
- Assign(net_file, netlist);
- Reset(net_file);
- x := 0;
- abort := False;
- while (x < (FileSize(net_file))) and Online and (not brk) do
- begin
- Seek(net_file, x);
- Read(net_file, net_hdr);
- Write(Com, 'Net ', net_num:4, ' ');
- offset := node_ptr;
- i := 1;
- while (net_name[i] <> Chr(0)) and (i <> 20) do
- begin
- str_name[i] := net_name[i];
- Inc(i)
- end;
- str_name[0] := Chr(i-1);
- if str_name[19] = ' ' then Delete(str_name, 19, 1);
- Write(Com, str_name:21, ' ');
- i := 1;
- while (net_city[i] <> Chr(0)) and (i <> 40) do
- begin
- str_city[i] := net_city[i];
- Inc(i)
- end;
- str_city[0] := Chr(i-1);
- WriteLn(Com, str_city);
- Inc(lines);
- if lines mod user_rec.lines = 0 then
- pause;
- Inc(x)
- end;
- Close(net_file);
- end;
- SetSect(HomName);
- end;
-
-
- procedure check_net(num : Integer;
- var offset,
- number_nodes : Integer;
- var OK : Boolean);
-
- var
- x : Integer;
-
- begin
- SetSect(fidolists);
- OK := False;
- with net_hdr do
- begin
- Assign(net_file, netlist);
- Reset(net_file);
- x := 0;
- while (x < (FileSize(net_file))) and (not OK) do
- begin
- Seek(net_file, x);
- Read(net_file, net_hdr);
- offset := node_ptr;
- number_nodes := num_nodes;
- Inc(x);
- OK := (net_num = num);
- end;
- Close(net_file);
- end;
- SetSect(HomName);
- end;
-
-
-
- procedure check_node(num, net_start,
- number_nodes : Integer;
- var OK : Boolean);
-
- var
- i, x : Integer;
-
- begin
- SetSect(fidolists);
- OK := False;
- with node_hdr do
- begin
- Assign(node_file, nodelist);
- Reset(node_file);
- x := net_start;
- i := 1;
- while (x < (FileSize(node_file))) and (not OK) and (i <= number_nodes) do
- begin
- Seek(node_file, x);
- Read(node_file, node_hdr);
- Inc(x);
- Inc(i);
- OK := (node_num = num)
- end;
- Close(node_file);
- end;
- SetSect(HomName);
- end;
-
-
- procedure show_nodes(offset, num_nodes : Integer);
-
- type
- Str20 = string[20];
- Str40 = string[40];
-
- var
- i, x,
- lines : Integer;
- str_name : Str20;
- str_city : Str40;
-
- begin
- SetSect(fidolists);
- abort := False;
- WriteLn(Com);
- with node_hdr do
- begin
- Assign(node_file, nodelist);
- Reset(node_file);
- Seek(node_file, offset);
- x := 1;
- lines := 1;
- while (x <= num_nodes) and (not brk) and (Online) do
- begin
- Read(node_file, node_hdr);
- Write(Com, 'Node ', node_num:4, ' ');
- i := 1;
- while (node_name[i] <> Chr(0)) and (i <> 20) do
- begin
- str_name[i] := node_name[i];
- Inc(i)
- end;
- str_name[0] := Chr(i-1);
- if str_name[19] = ' ' then Delete(str_name, 19, 1);
- Write(Com, str_name:21, ' ');
- i := 1;
- while (node_city[i] <> Chr(0)) and (i <> 40) do
- begin
- str_city[i] := node_city[i];
- Inc(i)
- end;
- str_city[0] := Chr(i-1);
- WriteLn(Com, str_city);
- Inc(lines);
- if lines mod user_rec.lines = 0 then
- pause;
- Inc(x)
- end;
- Close(node_file)
- end;
- SetSect(HomName)
- end;
-
-
- end. { of NETMISC.PAS}
-